import 'dart:convert';

class Location {
  String provinceName;
  String cityName;
  String districtName;
  String postalCode;

  Location({
    required this.provinceName,
    required this.cityName,
    required this.districtName,
    required this.postalCode,
  });
}

void extractLocationData(List<dynamic> cityData, List<String> provinces, List<String> cities, List<String> districts, List<String> postalCodes) {
  for (var provinceData in cityData) {
    String provinceName = provinceData['cityName'];

    for (var cityData in provinceData['children']) {
      String cityName = cityData['cityName'];

      for (var districtData in cityData['children']) {
        String districtName = districtData['cityName'];
        String postalCode = districtData['postalCode'];

        provinces.add(provinceName);
        cities.add(cityName);
        districts.add(districtName);
        postalCodes.add(postalCode);
      }
    }
  }
}